Re: Put a name on TChain ?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Apr 22 1998 - 22:22:22 MEST


Laurent Aphecetche wrote:
> 
> Hi,
> 
> Why chains do not have their own name ? It is thus impossible to access
> them via
> gROOT->FindObject().
> 
> Here's my problem. I would like to have a macro that create a chain, and
> then
> at the prompt line I would like to play with this chain :
> 
> void macro(Int_t i1, Int_t i2) {
> ...
>   TChain* chain = new TChain("thetreename");
>   for (i=i1;i<=i2;i++) chain->Add(filename[i]) ;
> }
> 
> root[1] .x macro.C(702,781)
> root[2] TChain* p=(TChain*)gROOT->FindObject("thetreename");
> root[3] ...play with p...
> 
> It seems to me that of course in line 2, it's the tree object that will
> be found. Why
> not a chain constructor like TChain::TChain(char* chainname, char*
> treename) ?

Hi Laurent,
You are making a good point.
Currently the TChain constructor has two parameters (treename, title)
where title is optional. It would have been better to have
(chainname, treename).
The problem is that I cannot introduce a second constructor like you
propose, unless I modify the existing constructor.
What about the following:
   TChain(const char *treename)
   TChain(const char *chainname, const char *treename)
This assumes that currently not many people use the TChain constructor
with two parameters.
Please comment on this proposal, objections,etc.

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:32 MET