*** Rene Brun wrote : > > 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 > Hi Rene, I would prefer a new member function TTree::SetChainName() or something like that. Changing the constructor is like changing the specs of routines like was sometimes done in the old CERNLIBs and you know what trouble that gave. Cheers, _/_/ _/ _/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/_/_/_/ _/ _/ *----------------------------------------------------------------------* Dr. Nick van Eijndhoven Department of Subatomic Physics email : nick@phys.uu.nl Utrecht University / NIKHEF tel. +31-30-2532331 (direct) P.O. Box 80.000 tel. +31-30-2531492 (secr.) NL-3508 TA Utrecht fax. +31-30-2518689 The Netherlands WWW : http://www.phys.uu.nl/~nick Office : Ornstein lab. 172 ---------------------------------------------------------------------- tel. +41-22-7679751 (direct) CERN PPE Division / ALICE exp. tel. +41-22-7675857 (secr.) CH-1211 Geneva 23 fax. +41-22-7679480 Switzerland CERN beep : 13+7294 Office : B 160 1-012 *----------------------------------------------------------------------*
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:32 MET