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

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Tue, 17 Apr 2012 10:43:52 -0500


Hi,

If you have enough memory to fit the entire file in memory, what you can do is copy the standard input (read as binary input) into a memory buffer and use it using TMemFile. (For a concrete example of TMemFile use, see tutorials/net/fastMergeServer.C) In short:

      TFile *file = new TMemFile(somename,buffer_start,buffer_end);

Cheers,
Philippe.

On 4/17/12 10:29 AM, Massimiliano Fasi wrote:
> Hi all,
>
> In order to use Apache Hadoop with MapReduce streaming, we need a c++ way to copy or cast a ROOT file passed through the standard
> input to any type of ROOT object (a TFile hopefully).
>
> Practically, we want to execute a command like
>
>> cat Myfile.root | MyAnalysisCode
>
> or
>
>> MyAnalysisCode < Myfile.root
>
> and then cast in MyAnalysisCode the standard input to something manageable by ROOT.
>
> Solutions we have tried so far didn't work. In particular, we tried to use the ifstream library but we wasn't able to cast their
> objects to something manageable by ROOT.
>
> Any hints or suggestions would be very appreciated.
>
> Thanks,
>
> Massimiliano
>
> ----------------------------------------------------------------
> This message was sent using IMP, the INFN Perugia Internet Messaging Program.
>
>
Received on Tue Apr 17 2012 - 17:44:00 CEST

This archive was generated by hypermail 2.2.0 : Thu May 03 2012 - 17:50:02 CEST