[ROOT] Reading a single Object from a Chain

From: koblitz@poly.in2p3.fr
Date: Tue Jun 24 2003 - 15:01:48 MEST


Hi,

I have problems reading a single object from a Chain, something which 
works for a normal file:
  TChain chain("Tree", "My Tree");
  chain.Add("file.root");
  TObject *o=chain.GetFile()->Get("MyObject");
does not work, because chain.GetFile() returns a null pointer unless one 
has at least connected to a branch on the file, first (which I use as a 
Workaround), while the following works allways:
  TFile f("file.root");
  TObject *o=f.Get("MyObject");
Is this is a design limitation, or a bug?
My personal conviction is, that it is probably a bug, because already 
connecting to a branch makes chain.GetFile() return the first file, while 
a design limitiation would probably require you to use GetEntry() on the 
chain, first.

My request is therefore to have TChain::GetFile() return the first file in 
the chain as soon as there is one added, or, implement a Get() method on 
the TChain.

Cheers,
  Birger

-- 
 Birger Koblitz                Tel: +33/1 69 33 31 73
 Ecole Polytechnique - LLR
 Route de Saclay
 F-91128 Palaiseau



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET