]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliESDInputHandlerRP.cxx
Improving event printout
[u/mrichter/AliRoot.git] / STEER / AliESDInputHandlerRP.cxx
index d985aa3d91f3a4a1af2ac75d1e16928d9257d4ed..3ad80c0a312f53efef3fd873af3c83b07fb2bb5d 100644 (file)
@@ -42,6 +42,7 @@ ClassImp(AliESDInputHandlerRP)
 AliESDInputHandlerRP::AliESDInputHandlerRP() :
     AliESDInputHandler(),
     fRTrees(   new TObjArray()),
+    fRDirs (   new TObjArray()),
     fRFiles(   new TList()),
     fDetectors(new TList()),
     fDirR(0),
@@ -60,6 +61,7 @@ AliESDInputHandlerRP::AliESDInputHandlerRP() :
 AliESDInputHandlerRP::AliESDInputHandlerRP(const char* name, const char* title):
     AliESDInputHandler(name, title),
     fRTrees(   new TObjArray()),
+    fRDirs (   new TObjArray()),
     fRFiles(   new TList()),
     fDetectors(new TList()),
     fDirR(0),
@@ -118,9 +120,7 @@ Bool_t AliESDInputHandlerRP::Init(Option_t* opt)
 Bool_t AliESDInputHandlerRP::BeginEvent(Long64_t entry)
 {
     // Begin the next event
-    // Delegate first to base class
-    AliESDInputHandler::BeginEvent(entry);
-//
+    //
     if (entry == -1) {
        fEventNumber++;
        entry = fEventNumber;
@@ -132,7 +132,12 @@ Bool_t AliESDInputHandlerRP::BeginEvent(Long64_t entry)
        AliWarning(Form("AliESDInputHandlerRP: Event number out of range %5d %5d\n", entry, fNEvents));
        return kFALSE;
     }
-    return LoadEvent(entry);
+    
+    LoadEvent(entry);
+
+    // Delegate to base class
+    return AliESDInputHandler::BeginEvent(entry);
+
 }
 
 Bool_t AliESDInputHandlerRP::LoadEvent(Int_t iev)
@@ -153,18 +158,20 @@ Bool_t AliESDInputHandlerRP::LoadEvent(Int_t iev)
     // Tree R
     TIter next(fRFiles);
     TFile* file;
-    Int_t idx = 0;
+    Int_t idx  = 0;
     
     while ((file = (TFile*) next()))
     {
        file->GetObject(folder, fDirR);
+       
        if (!fDirR) {
            AliWarning(Form("AliESDInputHandlerRP: Event #%5d not found\n", iev));
            return kFALSE;
        }
        TTree* tree = 0;
        fDirR->GetObject("TreeR", tree);
-       fRTrees->AddAt(tree, idx++);
+       fRDirs ->AddAt(fDirR, idx  );
+       fRTrees->AddAt(tree,  idx++);
     }
     return kTRUE;
 }
@@ -279,7 +286,7 @@ Bool_t AliESDInputHandlerRP::Notify(const char *path)
 Bool_t AliESDInputHandlerRP::FinishEvent()
 {
     // Clean-up after each event
-    delete fDirR;  fDirR = 0;
+    fRDirs->Delete();
     AliESDInputHandler::FinishEvent();
     return kTRUE;
 }