Hi Rene, Thanks for the suggestions, however, > The TSelector object is automatically deleted by TTreePlayer::Process. > If you use gObjectTable->Print, you should see only the current/last > selector object, not more. Having inspected the source code for TTreePlayer::Process I would expect this to happen, but repeated applications of EventCh->Process("TestSelec.C") on the same or different chains followed by gObjectTable->Print() does show that the number of TSelector objects does increase by one each time (although there is only ever one chain and one TTreePlayer). > In your MakeChain script, instead of > void MakeChain() { > do > TChain *MakeChain() { > .. //build your chain > return the pointer to the chain > I don't quite see how this modification to MakeChain would work (my limited C++ knowledge I'm afraid). Surely I'd then have to use MakeChain through TChain *EvCh = MakeChain() rather than just MakeChain(), so I'd still be creating a global pointer, but with one extra step? Is there a reason for TChains not being given a name so that they can be retrieved from gDirectory like TTrees and THistograms? Sorry for these extra questions, Ben Morgan. (Root 3.02/07 on RH7.1 on Linux PC). > On Fri, 14 Jun 2002, Ben Morgan wrote: > > > Hi ROOTers, > > I have a small script that chains a user defined set of files > > together, with the chain then being processed with code generated by > > MakeSelector. The basic process is: > > > > root [4] MakeChain() > > root [5] EventCh->Process("TestSelec.C") > > > > Whilst this works well (I can remake the chain and reprocess without any > > problem), I have two questions. Firstly, each call to EventCh->Process() > > , whether using the same chain again or creating a new one, creates a new > > TSelector object (visible in gObjectTable) which I don't > > seem to be able to access to delete before remaking the chain; is there > > any way to delete this before reprocessing the chain? I assume that > > the TSelector object created is owned by > > TChain or TTreePlayer, so I would have though that it would be > > automatically deleted when I delete and remake the chain, but it doesn't > > seem to be. > > > > Secondly, I need the chain to be available > > outside of MakeChain(), and the only way to do this seems to be to > > define a global pointer to the chain outside of MakeChain(): > > > > TChain *EventCh; > > void MakeChain() > > { > > ..... > > } > > > > I note from the ROOTtalk mailing list that there was a proposal to give > > TChain a 'name' so that it could be retrieved from gDirectory. > > http://root.cern.ch/root/roottalk/roottalk98/0651.html > > Was this implemented, as there doesn't seem to be anything in the > > documentation on TChain that suggests it was. > > > > I'm using ROOT v3.02/07 on a Linux PC with RH7.1. Thanks, > > > > Ben Morgan. > > > > -- > > ------------------------------------------------------------------------------- > > Mr. Ben Morgan > > Postgraduate Student > > University of Sheffield > > Department of Physics & Astronomy > > Hicks Building > > Hounsfield Road > > Sheffield S3 7RH > > ------------------------------------------------------------------------------- > > > > > > -- ------------------------------------------------------------------------------- Mr. Ben Morgan Postgraduate Student University of Sheffield Department of Physics & Astronomy Hicks Building Hounsfield Road Sheffield S3 7RH -------------------------------------------------------------------------------
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:57 MET