# Cannot open file using root://eoscms.cern.ch/ from compiled standalone executable

**URL:** <https://root-forum.cern.ch/t/cannot-open-file-using-root-eoscms-cern-ch-from-compiled-standalone-executable/52388>\
**Category:** Newbie\
**Tags:** root\
**Created:** [November 16, 2022, 10:38am UTC](https://root-forum.cern.ch/t/cannot-open-file-using-root-eoscms-cern-ch-from-compiled-standalone-executable/52388 "2022-11-16T10:38:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![amestvir](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/dc4da7/32.png) [@amestvir](https://root-forum.cern.ch/u/amestvir)\
**Post date:** [November 16, 2022, 10:38am UTC](https://root-forum.cern.ch/t/cannot-open-file-using-root-eoscms-cern-ch-from-compiled-standalone-executable/52388/1 "2022-11-16T10:38:03Z")

</div>

Dear ROOTers

I am new here and to be honest I do not know am I posting in correct category or not, but I hope you will forgive me that for a first time 🙂 🙂 , post will be little long. This is my first post here, usually reading was enough for me to solve some problems.

I have a little problem when I am trying to use path to file like this

`root://eoscms.cern.ch//eos/cms/store/user/amestvir/SingleMuon_ ....`

Reading and analyzing file containing root tree using compiled standalone executable. Path to the file I have in separate .list file, piece of code opening .list file and then opening root file is below

```auto
    while (input >> fileName ){
      if(fileName.c_str()[0]=='#') continue;
      if(fileName.c_str()[0]=='*') break;
      input_file_names.push_back(fileName.c_str());
    }

    
    for(int i=0;i<input_file_names.size();i++){
      fcount++;
      TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject(input_file_names[i].c_str());
      if (!f || !f->IsOpen()) {
	     f = new TFile(input_file_names[i].c_str(),"READ");
      }
         .
         .
         .
         .

```

```auto
Makefile to compile the code is simple, but code is long and not posting here whole code

CC=g++
IDIR=/disk1/root/include/
LDIR=/disk1/root/lib
CFLAGS=-I$(IDIR)

R_LDFLAGS=`root-config --ldflags`
R_LIBS=`root-config --libs`
R_CFLAGS=`root-config --cflags`
R_ALL = $(R_LADFLAGS) $(R_LIBS) $(R_CFLAGS)

myanalysis:
        $(CC) $(CFLAGS) MyAna.C MyMuMu.o -o MyAnalysis $(R_ALL) $(LIBS)

```

When I am mounting

`sshfs amestvir@lxplus.cern.ch:/eos/user/a/amestvir/ /disk1/eos`

and then using .list file where the path to .root file is like that

```auto
/disk1/eos/NanoAOD/SingleMuon_Run2016B-ver1_HIPM_UL2016_MiniAODv2_NanoAODv9-v2_NANOAOD/BB6DC570-2223-7B43-BB87-2526FB1639B4.root

```

Everything is fine. Opening and reading file with no problem

After that I decided to read the file using these format

`root://eoscms.cern.ch//eos/cms/store/user/amestvir/SingleMuon_Run2016B-ver1_HIPM_UL2016_MiniAODv2_NanoAODv9-v2_NANOAOD/BB6DC570-2223-7B43-BB87-2526FB1639B4.root`

Installed eos, (system says new users can not include links) There are instructions how to install eos on ubuntu)

Installed xrootd version v5.5.0

```auto
aliko@pc-iowaa1:~/HmmAnalysis$ xrootd -v
v5.5.0

```

xrdcp works perfectly, copies files to/from with no problem

I can access eos , checking file - it is there and is online

```auto

aliko@pc-iowaa1:~/HmmAnalysis$ eos root://eoscms.cern.ch
# ---------------------------------------------------------------------------
# EOS Copyright (C) 2011-2020 CERN/Switzerland
# This program comes with ABSOLUTELY NO WARRANTY; for details type `license'.
# This is free software, and you are welcome to redistribute it 
# under certain conditions; type `license' for details.
# ---------------------------------------------------------------------------
EOS_INSTANCE=eoscms
EOS_SERVER_VERSION=5.1.1 EOS_SERVER_RELEASE=1
EOS_CLIENT_VERSION=4.8.94 EOS_CLIENT_RELEASE=1
EOS Console [root://eoscms.cern.ch] |/eos/cms/store/user/amestvir/SingleMuon_Run2016B-ver1_HIPM_UL2016_MiniAODv2_NanoAODv9-v2_NANOAOD/> ls
BB6DC570-2223-7B43-BB87-2526FB1639B4.root
EOS Console [root://eoscms.cern.ch] |/eos/cms/store/user/amestvir/SingleMuon_Run2016B-ver1_HIPM_UL2016_MiniAODv2_NanoAODv9-v2_NANOAOD/> file info BB6DC570-2223-7B43-BB87-2526FB1639B4.root
  File: '/eos/cms/store/user/amestvir/SingleMuon_Run2016B-ver1_HIPM_UL2016_MiniAODv2_NanoAODv9-v2_NANOAOD/BB6DC570-2223-7B43-BB87-2526FB1639B4.root' Flags: 0644
  Size: 1089283188
Status: healthy
Modify: Tue Nov 15 10:52:52 2022 Timestamp: 1668505972.096425000
Change: Tue Nov 15 10:53:36 2022 Timestamp: 1668506016.013357612
 Birth: Tue Nov 15 10:52:43 2022 Timestamp: 1668505963.248177316
  CUid: 12218 CGid: 1399 Fxid: e4f68a53 Fid: 3841362515 Pid: 112550745 Pxid: 06b56359
XStype: adler XS: d3 8c f6 7f ETAGs: "1031157898375331840:d38cf67f"
Layout: replica Stripes: 2 Blocksize: 4k LayoutId: 00600112 Redundancy: d2::t0 
  #Rep: 2
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?no.? fs-id? host? schedgroup? path? boot? configstatus? drain? active? geotag?
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
 0 29243 st-096-ff8094f7.cern.ch default.60 /data95 booted rw nodrain online 68a8c9fc::0513::S::0034::SE12 
 1 27871 st-096-dd905ace.cern.ch default.60 /data32 booted rw nodrain online f3b0d31b::0513::S::0034::SL13 

*******
EOS Console [root://eoscms.cern.ch] |/eos/cms/store/user/amestvir/SingleMuon_Run2016B-ver1_HIPM_UL2016_MiniAODv2_NanoAODv9-v2_NANOAOD/>

```

Accessing the file from root using

```auto

root root://eoscms.cern.ch//eos/cms/store/user/amestvir/SingleMuon_Run2016B-ver1_HIPM_UL2016_MiniAODv2_NanoAODv9-v2_NANOAOD/BB6DC570-2223-7B43-BB87-2526FB1639B4.root

```

No problem, fine

but when I am running like this

```auto
aliko@pc-iowaa1:~/HmmAnalysis$ MyAnalysis realEOS.list

Requested 500000 events
Histograms booked
Wed 16 Nov 2022 10:18:40 AM CET

 *****1 data files in realEOS.list file*****

Error in <TFile::TFile>: file /eos/cms/store/user/amestvir/SingleMuon_Run2016B-ver1_HIPM_UL2016_MiniAODv2_NanoAODv9-v2_NANOAOD/BB6DC570-2223-7B43-BB87-2526FB1639B4.root does not exist

```

In the file realEOS.list there is one line

```auto

root://eoscms.cern.ch//eos/cms/store/user/amestvir/SingleMuon_Run2016B-ver1_HIPM_UL2016_MiniAODv2_NanoAODv9-v2_NANOAOD/BB6DC570-2223-7B43-BB87-2526FB1639B4.root

```

I used like this

`root://eoscms.cern.ch/// ....`

or like this

`root://eoscms.cern.ch:// ....`

But nothing helps. Needless to say, that all above writing of root://eoscms … works perfectly from just root.

Voms is installed and creates valid proxy, but some error messages, namely verification error

```auto
aliko@pc-iowaa1:~/HmmAnalysis$ voms-proxy-init --voms cms
Enter GRID pass phrase:
Your identity: /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=amestvir/CN=456424/CN=Alexi Mestvirishvili
Creating temporary proxy ............................. Done
Contacting voms-cms-auth.app.cern.ch:443 [/DC=ch/DC=cern/OU=computers/CN=cms-auth.web.cern.ch] "cms" Failed

Error: Server Answer was incorrectly formatted.

Trying next server for cms.
Creating temporary proxy ......................................................... Done
Contacting lcg-voms2.cern.ch:15002 [/DC=ch/DC=cern/OU=computers/CN=lcg-voms2.cern.ch] "cms" Done
Creating proxy ........................................................................ Done

Your proxy is valid until Wed Nov 16 22:26:06 2022
Error: verification failed.
Cannot verify AC signature!

```

Here are some verification errors, but in one of the discussions I found, that this error message could be ignored. Unfortunately I can not find this discussions again

**I do not know what to do more. I believe solution is something simple. May be I am not linking some libs? But no error at the linking stage**

**Am I using not compatible with each other versions of software?**

**Any suggestions or help is appreciated**

Obviously simplest solution is to run how it works and do not bother myself using the path like this

```auto

root://eoscms.cern.ch//eos/cms/store/user/amestvir/.....

```

But I want to use it like this !!!

🙂 🙂

_ROOT Version:_ **6.24/02**  
_Platform:_ **Ubuntu 20.4 LTE**  
_Compiler:_

```auto
 g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-Av3uEd/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)

```

* * *

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [November 16, 2022, 11:32am UTC](https://root-forum.cern.ch/t/cannot-open-file-using-root-eoscms-cern-ch-from-compiled-standalone-executable/52388/2 "2022-11-16T11:32:50Z")

</div>

Hi @amestvir ,

congrats on your first post – it’s a very good post 😃 Instead of `new TFile(...)` you need `TFile::Open(...)`. Ideally the error message would tell you, as suggested in [TFile's ctor's error message should point to TFile::Open when filename contains "://" · Issue #10039 · root-project/root · GitHub](https://github.com/root-project/root/issues/10039) . cc: @pcanal .

Cheers,  
Enrico

---

<div class="post-metadata">

**Author:** ![amestvir](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/dc4da7/32.png) [@amestvir](https://root-forum.cern.ch/u/amestvir)\
**Post date:** [November 16, 2022, 11:41am UTC](https://root-forum.cern.ch/t/cannot-open-file-using-root-eoscms-cern-ch-from-compiled-standalone-executable/52388/3 "2022-11-16T11:41:45Z")

</div>

As I said , something simple 🙂 🙂 . Thanks a lot, Enirco

Alexi

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [November 16, 2022, 1:33pm UTC](https://root-forum.cern.ch/t/cannot-open-file-using-root-eoscms-cern-ch-from-compiled-standalone-executable/52388/4 "2022-11-16T13:33:14Z")

</div>

Work in progress here: [[IO] Improve error message when no TFile::Open for remote files by eguiraud · Pull Request #11719 · root-project/root · GitHub](https://github.com/root-project/root/pull/11719)
