Hi Jiri, for me this fails only when the file has not been opened. See: root [0] TFile *n = (TFile*)gROOT->FindObject("rfio:/castor/cern.ch/user/r/rdm/hsimple.root") Error in <TROOT::cd>: No such file rfio:/castor/cern.ch/user/r/rdm/hsimple.root root [1] TFile *f = TFile::Open("rfio:/castor/cern.ch/user/r/rdm/hsimple.root") root [2] TFile *n = (TFile*)gROOT->FindObject("rfio:/castor/cern.ch/user/r/rdm/hsimple.root") root [3] n (class TFile*)0x86e0748 Cheers, Fons. On Thu, 2002-02-14 at 11:41, Jiri Chudoba wrote: > Hello, > > I use the following code to test is the file filename is already opened: > > // check if the file was already opened by some other code > TFile *f = static_cast<TFile *>(gROOT->FindObject(filename)); > > It works, but when I use rfio: prefix in the file name, I get an error > message: > Error in <TFile::cd>: No such file rfio:/castor/cern.ch/user/j/jchudoba/TESTPROD/00003/00097 > > It is because TDirectory::Get does cd to the filename. > > #0 TDirectory::cd1 (this=0x8bd98b0, apath=0x7ffdda70 > "rfio:/castor/cern.ch/user/j/jchudoba/TESTPROD/00003/00097") at > base/src/TDirectory.cxx:317 > #1 0x2ab9cc29 in TDirectory::cd (this=0x8bd98b0, path=0x7ffdda70 > "rfio:/castor/cern.ch/user/j/jchudoba/TESTPROD/00003/00097") at > base/src/TDirectory.cxx:276 > #2 0x2ab9ee5e in TDirectory::Get (this=0x8bd98b0, namecycle=0x8bcea1c > "rfio:/castor/cern.ch/user/j/jchudoba/TESTPROD/00003/00097/galice.root") at > base/src/TDirectory.cxx:823 > #3 0x2abc8fa0 in TROOT::FindObject (this=0x2aed3300, name=0x8bcea1c > "rfio:/castor/cern.ch/user/j/jchudoba/TESTPROD/00003/00097/galice.root") at > base/src/TROOT.cxx:520 > > > What should I use to get rid of this error message? > > Thanks, cheers, > Jiri. > > PS: root 3.02/07 on redhat 6.1 > > ************************************************************************* > * E-mail address: Jiri.Chudoba@cern.ch * > * WWW Homepage : http://delphiwww.troja.mff.cuni.cz/chudoba/ * > * Telephone : +41 22 76 72288 * > * Fax : +41 22 76 79480 * > ************************************************************************* -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7679480
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:41 MET