Hi Ben,
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.
In your MakeChain script, instead of
void MakeChain() {
do
TChain *MakeChain() {
.. //build your chain
return the pointer to the chain
Rene Brun
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
> -------------------------------------------------------------------------------
>
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:57 MET