Re: [ROOT] merging Ntuples in a single file

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Nov 21 2002 - 08:48:09 MET


Hi Felix,

You have two possibilities
 -1: call tree.AutoSave at regular intervals
 -2: use the following procedure
     tree.AutoSave
     delete file
     TFile *file = new TFile("myfile.root","update");
     TTree *tree = (TTree*)file->Get("tree");
     loop on tree->Fill
     etc..

Rene Brun

On Wed, 20 Nov 2002, Eftychios Matathias wrote:

> 
> Dear all,
> first of all this is my first message to the roottalk list although I have 
> been using root for a couple of years now. My name is Felix Matathias and 
> I am a grad student at the Relativistic Heavy Ion Group at the 
> State University of New York at Stony Brook and a member of the PHENIX 
> collaboration. Enough said :) Root Rocks!
> 
> 
> To the problem now:
> I have an online monitoring program, always running, that periodically 
> writes an ntuple to a file. I open the file, write the ntuple, 
> close the file, reset the ntuple, fill new data and the loop continues. 
> 
> The problem is that even if I open the file to write in UPDATE mode the 
> ntuples are written as diffenent keys/objects instead for a single merged 
> ntuple. And therefore a user cannot operate at the prompt and draw the 
> entire history.
> 
> Is there a way of avoiding this ?
> 
> I am familiar with the way to retrieve all the keys and merge them into a 
> single Ntuple etc. but I was wondering if root can do such a thing 
> automatically. I am considering doing the Autosave()/SaveSelf() trick but 
> I am a bit nervous having a file open for such a long period of time. 
> 
> Best Regards,
> Felix
> 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:20 MET