]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Give back a clone of the original chain.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 7 Jul 2008 13:52:37 +0000 (13:52 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 7 Jul 2008 13:52:37 +0000 (13:52 +0000)
ANALYSIS/AliEventPoolLoop.cxx
ANALYSIS/AliEventPoolLoop.h

index f16128b59fc15b2e8a99aad1063e44f7f304c518..dd3dc78eb01e3b1e110cda5e16e3804ba5d2d7c6 100644 (file)
@@ -24,6 +24,9 @@
 
 
 #include "AliEventPoolLoop.h"
+#include <TChain.h>
+#include <TFile.h>
+#include <TObjArray.h>
 
 ClassImp(AliEventPoolLoop)
 
@@ -33,7 +36,8 @@ ClassImp(AliEventPoolLoop)
 AliEventPoolLoop::AliEventPoolLoop():
     AliVEventPool(),
     fMaxIterations(0),
-    fNIteration(0)
+    fNIteration(0),
+    fChainClone(0)
 {
   // Default constructor
 }
@@ -41,7 +45,8 @@ AliEventPoolLoop::AliEventPoolLoop():
 AliEventPoolLoop::AliEventPoolLoop(Int_t nit):
     AliVEventPool(),
     fMaxIterations(nit),
-    fNIteration(0)
+    fNIteration(0),
+    fChainClone(0)
 {
   // Default constructor
 }
@@ -49,7 +54,8 @@ AliEventPoolLoop::AliEventPoolLoop(Int_t nit):
 AliEventPoolLoop::AliEventPoolLoop(const char* name, const char* title):
     AliVEventPool(name, title),
     fMaxIterations(0),
-    fNIteration(0)
+    fNIteration(0),
+    fChainClone(0)
 {
   // Constructor
 }
@@ -88,7 +94,24 @@ TChain* AliEventPoolLoop::GetNextChain()
        return (0);
     } else {
        fNIteration++;
-       return fChain;
+       /*
+       if (fChainClone) {
+         fChainClone->Reset();
+         new (fChainClone) TChain(fChain->GetName());
+       } else {
+         fChainClone = new TChain(fChain->GetName());
+       }
+       TObjArray* files = fChain->GetListOfFiles();
+       Int_t n = files->GetEntriesFast();
+       for (Int_t i = 0; i < n; i++) {
+         TFile* file = (TFile*) (files->At(i));
+         fChainClone->AddFile(file->GetTitle());
+         printf("Adding %s %s %s\n", fChainClone->GetName(), file->GetName(), file->GetTitle());
+
+       }
+       */
+       fChainClone = (TChain*) (fChain->Clone());
+       return fChainClone;
     }
 }
 
index 6d21d4d75a5baead762b701897c281b8f46c5449..87ce186c3f1cbf9b311e20e5e0e392903c55d7a4 100644 (file)
@@ -18,6 +18,7 @@ class AliLHCTagCuts;
 class AliDetectorTagCuts;
 class AliEventTagCuts;
 class AliTagAnalysis;
+class TChain;
 
 class AliEventPoolLoop : public AliVEventPool
 {
@@ -38,6 +39,7 @@ class AliEventPoolLoop : public AliVEventPool
  protected:
     Int_t fMaxIterations;
     Int_t fNIteration;
+    TChain* fChainClone; // Clone of the original 
     ClassDef(AliEventPoolLoop, 0); 
 };