Re: [ROOT] listing of all the alive TObjects in a root session

From: Victor Perevoztchikov (perev@bnl.gov)
Date: Tue Oct 16 2001 - 17:47:41 MEST


Hi Isi,

I have simple CINT script file to do this.
Formally it is not legal approach, but it works on Linux.
If you ask Rene to add some method into TObjectTable
then it could be an official.

File is attached.
Victor



Isard_Dunietz wrote:
> 
> Dear experts,
>  Is there a way to list all the TObjects by name that are currently alive
> (1. such as automatic variables in scope and 2. newed TObjects that have
> not been deleted yet)?
>   I have seen it done but cannot find documentation for it.
> 
>    Thank you, Isi Dunietz

-- 
Victor M. Perevoztchikov   perev@bnl.gov  perev@vxcern.cern.ch       
Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000
tel office : 631-344-7894; fax 631-344-4206; home 631-345-2690

{

int sz = gObjectTable->GetSize();

TObject **tab = *((TObject ***)((char*)gObjectTable+12));
TObject *to;
printf ("tab %p[%d]\n",tab,sz);
int i,num=0,v3=0;
for (i=0;i<sz;i++)
{
  if (!tab[i]) continue;
  num++;
  to = tab[i];
  if (strcmp("StThreeVectorF",to->ClassName())) continue;
  v3++;
  if (to == (TObject*)0xa17dbf8) printf("BOT OHO &d\n",i);
}
printf ("tab %p[%d] v3=%d\n",tab,num,v3);


}



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:03 MET