]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Creation of buffer delayed until Init()
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 31 Aug 2010 11:59:54 +0000 (11:59 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 31 Aug 2010 11:59:54 +0000 (11:59 +0000)
Buffer not streamed.

ANALYSIS/AliMultiEventInputHandler.cxx
ANALYSIS/AliMultiEventInputHandler.h

index a00d9313d2817600e2905aa6e65aff0759e2bfee..aec7d5162abe34c1024115bd1f815cc54940657c 100644 (file)
@@ -55,17 +55,9 @@ AliMultiEventInputHandler::AliMultiEventInputHandler(Int_t size, Int_t format) :
     fIndex(0),
     fCurrentBin(0),
     fEventPool(0),
-    fEventBuffer(new AliVEvent*[size])
+    fEventBuffer(0)
 {
-  // Default constructor
-    for (Int_t i = 0; i < size; i++) 
-       if (fFormat == 1) {
-           fEventBuffer[i] = new AliAODEvent();
-       } else if (fFormat == 0) {
-           fEventBuffer[i] = new AliESDEvent();
-       } else{
-           AliWarning(Form("Unknown Format %5d", fFormat));
-       }
+  // constructor
 }
 
 //______________________________________________________________________________
@@ -77,17 +69,10 @@ AliMultiEventInputHandler::AliMultiEventInputHandler(const char* name, const cha
     fIndex(0),
     fCurrentBin(0),
     fEventPool(0),
-    fEventBuffer(new AliVEvent*[size])
+    fEventBuffer(0)
 {
     // Constructor
-    for (Int_t i = 0; i < size; i++) 
-       if (fFormat == 1) {
-           fEventBuffer[i] = new AliAODEvent();
-       } else if (fFormat == 0) {
-           fEventBuffer[i] = new AliESDEvent();
-       } else{
-           AliWarning(Form("Unknown Format %5d", fFormat));
-       }
+
 }
 
 //______________________________________________________________________________
@@ -99,6 +84,20 @@ AliMultiEventInputHandler::~AliMultiEventInputHandler()
 Bool_t AliMultiEventInputHandler::Init(TTree* tree, Option_t* /*opt*/)
 {
     // Initialisation necessary for each new tree
+    if (!fEventBuffer) {
+       fEventBuffer = new AliVEvent*[fBufferSize];
+       
+       for (Int_t i = 0; i < fBufferSize; i++) 
+           if (fFormat == 1) {
+               fEventBuffer[i] = new AliAODEvent();
+           } else if (fFormat == 0) {
+               fEventBuffer[i] = new AliESDEvent();
+           } else{
+               AliWarning(Form("Unknown Format %5d", fFormat));
+           }
+    }
+    
+
     fTree = tree;
     if (!fTree) return kFALSE;
     for (Int_t i = 0; i < fBufferSize; i++) 
@@ -111,16 +110,20 @@ Bool_t AliMultiEventInputHandler::Init(TTree* tree, Option_t* /*opt*/)
 
 Bool_t AliMultiEventInputHandler::Notify(const char */*path*/)
 {
+    // Connect to new tree
+
+       
     static Bool_t first = kTRUE;
     
-    // Connect to new tree
+    
     if (first) {
        fEventBuffer[0]->ReadFromTree(fTree, "");
        first = kFALSE;
     } else {
-       fEventBuffer[0]->ReadFromTree(fTree, "reconnect");
+       fEventBuffer[0]->ReadFromTree(fTree, "reconnect");
     }
     
+    
     return (kTRUE);
 }
 
index bea1092ac2a2470e096de1fa34daa56273fda70e..ac8d491f0d1539e470546a08c451ae922b40515a 100644 (file)
@@ -50,7 +50,7 @@ class AliMultiEventInputHandler : public AliInputEventHandler {
     Int_t          fIndex;        // Pointer to most recent event
     Int_t          fCurrentBin;   // Current bin from the pool
     AliVEventPool* fEventPool;    // Pointer to the pool
-    AliVEvent**    fEventBuffer;  // The event buffer
+    AliVEvent**    fEventBuffer;  //! The event buffer
     ClassDef(AliMultiEventInputHandler, 1);
 };