Re: Manage a ROOT file from a streaming of the ROOT file content

From: Fons Rademakers <Fons.Rademakers_at_cern.ch>
Date: Sat, 21 Apr 2012 12:35:44 +0200


Hi,

   to any I/O plugin work you have to open the files via TFile::Open(), like

TFile* fileInput = TFile::Open(line.c_str());

this static method will load the HDFS plugin triggered by hdfs:// an will return a TFile derived THDFSFile object. The way you were doing it you were getting a standard local TFile object that was trying to open a local file.

Let me know if you've more success with TFile::Open().

Cheers, Fons.

On 21/04/12 9:08, Massimiliano Fasi wrote:
> Dear all,
>
> we tried to use hdfs plugin with a very simple ROOT code (attached), but we
> get the issue described below.
>
> We succesfully created a TFile pointer, with a statement like:
>
> TFile* fileInput = new
> TFile("hdfs://hydra1:54310/user/mySearchTreeFile.root");
>
> and a TTree pointer with:
>
> TTree* myTree= (TTree *)fileInput->Get("data2");
>
> but when we call any method on myTree, as
>
> myTree->Print();
>
> we get that error at runtime:
>
> Error in <TFile::TFile>: file user/mySearchTreeFile.root does not exist
>
> *** Break *** segmentation violation
> [ stack trace follows ]
>
> We don't understand why we don't get any error when we create the object,
> and what causes such kind of issue. Have you got any idea about?
>
> Thanks,
>
> Massimiliano
>
> ----------------------------------------------------------------
> This message was sent using IMP, the INFN Perugia Internet Messaging Program.
>

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers_at_cern.ch              Phone: +41 22 7679248
WWW:    http://fons.rademakers.org           Fax:   +41 22 7669640


Received on Sat Apr 21 2012 - 12:35:53 CEST

This archive was generated by hypermail 2.2.0 : Sun Apr 22 2012 - 11:50:02 CEST