]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Avoiding memory problems.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 3 Feb 2009 08:37:07 +0000 (08:37 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 3 Feb 2009 08:37:07 +0000 (08:37 +0000)
STEER/AliESDInputHandlerRP.cxx
STEER/AliESDInputHandlerRP.h

index 3fce5451d198f9664237cab74f0bfe53bb28f37c..26810c5ec23c2eab27b01008e6a633c527485215 100644 (file)
@@ -27,6 +27,7 @@
 #include <TSystemDirectory.h>
 #include <TString.h>
 #include <TObjString.h>
+#include <TObjArray.h>
 #include <TProcessID.h>
 
 #include "AliESDInputHandlerRP.h"
@@ -39,7 +40,7 @@ ClassImp(AliESDInputHandlerRP)
 //______________________________________________________________________________
 AliESDInputHandlerRP::AliESDInputHandlerRP() :
     AliESDInputHandler(),
-    fRTrees(   new TList()),
+    fRTrees(   new TObjArray()),
     fRFiles(   new TList()),
     fDetectors(new TList()),
     fDirR(0),
@@ -57,7 +58,7 @@ AliESDInputHandlerRP::AliESDInputHandlerRP() :
 //______________________________________________________________________________
 AliESDInputHandlerRP::AliESDInputHandlerRP(const char* name, const char* title):
     AliESDInputHandler(name, title),
-    fRTrees(   new TList()),
+    fRTrees(   new TObjArray()),
     fRFiles(   new TList()),
     fDetectors(new TList()),
     fDirR(0),
@@ -152,6 +153,7 @@ Bool_t AliESDInputHandlerRP::LoadEvent(Int_t iev)
     TIter next(fRFiles);
     TFile* file;
     Int_t idx = 0;
+    
     while ((file = (TFile*) next()))
     {
        file->GetObject(folder, fDirR);
@@ -160,7 +162,7 @@ Bool_t AliESDInputHandlerRP::LoadEvent(Int_t iev)
            return kFALSE;
        }
        TTree* tree = 0;
-       fDirR ->GetObject("TreeR", tree);
+       fDirR->GetObject("TreeR", tree);
        fRTrees->AddAt(tree, idx++);
     }
     return kTRUE;
@@ -216,6 +218,7 @@ Bool_t AliESDInputHandlerRP::Notify(const char *path)
     if (fPathName->Contains(".zip")) fIsArchive = kTRUE;
 
     TSeqCollection* members;
+
     
     if (fIsArchive) {
        // Archive
@@ -227,15 +230,14 @@ Bool_t AliESDInputHandlerRP::Notify(const char *path)
        TSystemDirectory dir(".", fPathName->Data());
        members = dir.GetListOfFiles();
     }
-    
+
     TIter next(members);
     TFile* entry;
     Int_t ien = 0;
-    fRTrees->Clear();
+    fDetectors->Delete();
     
     while ( (entry = (TFile*) next()) )
     {
-       printf("File %s \n", entry->GetName());
        TString name(entry->GetName());
        TObjArray* tokens = name.Tokenize(".");
        Int_t ntok = tokens->GetEntries();
@@ -243,8 +245,9 @@ Bool_t AliESDInputHandlerRP::Notify(const char *path)
        TString str = ((TObjString*) tokens->At(1))->GetString();
        if (!(strcmp(str.Data(), "RecPoints"))){
            TString det = ((TObjString*) tokens->At(0))->GetString();
-           printf("Name  %s \n", det.Data());
+           printf("Found file with RecPoints for %s \n", det.Data());
            TNamed* ent = new TNamed(det.Data(), det.Data());
+           fRTrees->AddAt(0, ien);
            ent->SetUniqueID(ien++);
            fDetectors->Add(ent);
        }
@@ -274,8 +277,7 @@ Bool_t AliESDInputHandlerRP::FinishEvent()
 void AliESDInputHandlerRP::ResetIO()
 {
 // Delete trees and files
-//    fRTrees->Clear();
-    fRFiles->Clear();
+    fRFiles->Delete();
     fExtension="";
 }
 
index 8460cbec8da35577001fea96b151f240647d9b1a..25f4c7fae88d6638757e60c1ea5dd617f60c2c38 100644 (file)
@@ -41,7 +41,7 @@ class AliESDInputHandlerRP : public AliESDInputHandler {
     AliESDInputHandlerRP(const AliESDInputHandlerRP& handler);             
     AliESDInputHandlerRP& operator=(const AliESDInputHandlerRP& handler);  
  private:
-    TList*          fRTrees;           // List of RecPoint Trees
+    TObjArray*      fRTrees;           // List of RecPoint Trees
     TList*          fRFiles;           // List of RecPoint Files
     TList*          fDetectors;        // List of detector names
     TDirectoryFile *fDirR;             //! Directory for RP Tree