Hi, I am reading a tree from the root file. One branch of this tree has TClonesArray of objects inherited from TObject. When I read this array by the script attached, I observe that the number of my objects in the memory increases, they are not deleted. The root file which I tested with this script is /afs/cern.ch/user/k/kharlov/public/AliRoot/galice.root. I use root 3.03.06 and gcc 3.1. The root-file was created by AliRoot package (exp. ALICE). Yuri Kharlov IHEP (Protvino) / Subatech-IN2P3 (Nantes) > #if !defined(__CINT__) #include "TObjectTable.h" #include "TClonesArray.h" #include "TTree.h" #include "TBranch.h" #include "TFile.h" #endif void ReadHits() { TFile* f = new TFile("galice.root","read"); TTree * hitstree; TBranch * hitsbranch; char treeName[20]; TClonesArray * hits = new TClonesArray("AliPHOSHit",1) ; for (Int_t iev=0; iev<10; iev++) { sprintf(treeName,"TreeH\%d",iev); hitstree = (TTree*)f->Get(treeName); if (hitstree) { hitsbranch = hitstree->GetBranch("PHOS"); hitsbranch ->SetAddress(&hits); hitsbranch ->GetEntry(0); printf("Hits arrays contains %d entries\n",hits->GetEntries()); hits->Clear(); } else { printf("Tree %s does not exist\n",treeName); } gObjectTable->Print(); } }
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:04 MET