Interfaced to AliVirtualEventHandler
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 4 Jun 2007 16:27:21 +0000 (16:27 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 4 Jun 2007 16:27:21 +0000 (16:27 +0000)
ANALYSIS/AliAnalysisManager.cxx
ANALYSIS/AliAnalysisManager.h

index 29dacf6..e02ade8 100644 (file)
@@ -37,6 +37,7 @@
 #include "AliAnalysisTask.h"
 #include "AliAnalysisDataContainer.h"
 #include "AliAnalysisDataSlot.h"
+#include "AliVirtualEventHandler.h"
 #include "AliAnalysisManager.h"
 
 ClassImp(AliAnalysisManager)
@@ -47,6 +48,7 @@ AliAnalysisManager *AliAnalysisManager::fgAnalysisManager = NULL;
 AliAnalysisManager::AliAnalysisManager() 
                    :TNamed(),
                     fTree(NULL),
+                   fEventHandler(NULL),
                     fCurrentEntry(-1),
                     fMode(kLocalAnalysis),
                     fInitOK(kFALSE),
@@ -66,6 +68,7 @@ AliAnalysisManager::AliAnalysisManager()
 AliAnalysisManager::AliAnalysisManager(const char *name, const char *title)
                    :TNamed(name,title),
                     fTree(NULL),
+                   fEventHandler(NULL),
                     fCurrentEntry(-1),
                     fMode(kLocalAnalysis),
                     fInitOK(kFALSE),
@@ -92,6 +95,7 @@ AliAnalysisManager::AliAnalysisManager(const char *name, const char *title)
 AliAnalysisManager::AliAnalysisManager(const AliAnalysisManager& other)
                    :TNamed(other),
                     fTree(NULL),
+                   fEventHandler(NULL),
                     fCurrentEntry(-1),
                     fMode(other.fMode),
                     fInitOK(other.fInitOK),
@@ -120,6 +124,7 @@ AliAnalysisManager& AliAnalysisManager::operator=(const AliAnalysisManager& othe
    if (&other != this) {
       TNamed::operator=(other);
       fTree       = NULL;
+      fEventHandler = other.fEventHandler;
       fCurrentEntry = -1;
       fMode       = other.fMode;
       fInitOK     = other.fInitOK;
@@ -206,7 +211,9 @@ void AliAnalysisManager::SlaveBegin(TTree *tree)
    if (fDebug > 1) {
       cout << "->AliAnalysisManager::SlaveBegin()" << endl;
    }
-
+   // Call InitIO of EventHandler
+   fEventHandler->InitIO();
+   //
    TIter next(fTasks);
    AliAnalysisTask *task;
    // Call CreateOutputObjects for all tasks
@@ -285,6 +292,8 @@ void AliAnalysisManager::PackOutput(TList *target)
       return;
    }
 
+   fEventHandler->Terminate();
+   
    if (fMode == kProofAnalysis) {
       TIter next(fOutputs);
       AliAnalysisDataContainer *output;
@@ -403,6 +412,8 @@ void AliAnalysisManager::Terminate()
    if (fDebug > 1) {
       cout << "<-AliAnalysisManager::Terminate()" << endl;
    }   
+   //
+   fEventHandler->TerminateIO();
 }
 
 //______________________________________________________________________________
@@ -715,6 +726,7 @@ void AliAnalysisManager::ExecAnalysis(Option_t *option)
          }   
          task->ExecuteTask(option);
       }
+      fEventHandler->Fill();
       return;
    }   
    // The event loop is not controlled by TSelector   
@@ -726,6 +738,7 @@ void AliAnalysisManager::ExecAnalysis(Option_t *option)
       }   
       task->ExecuteTask(option);
    }   
+   fEventHandler->Fill();
 }
 
 //______________________________________________________________________________
index 83cf30b..ef553d4 100644 (file)
@@ -21,6 +21,8 @@ class TClass;
 class TTree;
 class AliAnalysisDataContainer;
 class AliAnalysisTask;
+class AliVirtualEventHandler;
+
 
 class AliAnalysisManager : public TNamed {
 
@@ -81,6 +83,9 @@ enum EAliAnalysisFlags {
    void                SetCurrentEntry(Long64_t entry) {fCurrentEntry = entry;}
    void                SetDebugLevel(UInt_t level) {fDebug = level;}
    void                SetDisableBranches(Bool_t disable=kTRUE) {TObject::SetBit(kDisableBranches,disable);}
+   void                SetEventHandler(AliVirtualEventHandler* handler) {fEventHandler = handler;}
+   AliVirtualEventHandler*
+                       GetEventHandler() {return fEventHandler;}
 
    // Container handling
    AliAnalysisDataContainer *CreateContainer(const char *name, TClass *datatype, 
@@ -113,17 +118,18 @@ protected:
    void                 SetEventLoop(Bool_t flag=kTRUE) {TObject::SetBit(kEventLoop,flag);}
 
 private:
-   TTree               *fTree;         //! Input tree in case of TSelector model
-   Long64_t             fCurrentEntry; //! Current processed entry in the tree
-   EAliAnalysisExecMode fMode;         // Execution mode
-   Bool_t               fInitOK;       // Initialisation done
-   UInt_t               fDebug;        // Debug level
-   TObjArray           *fTasks;        // List of analysis tasks
-   TObjArray           *fTopTasks;     // List of top tasks
-   TObjArray           *fZombies;      // List of zombie tasks
-   TObjArray           *fContainers;   // List of all containers
-   TObjArray           *fInputs;       // List of containers with input data
-   TObjArray           *fOutputs;      // List of containers with results
+   TTree                  *fTree;         //! Input tree in case of TSelector model
+   AliVirtualEventHandler *fEventHandler; //  Output event handler
+   Long64_t                fCurrentEntry; //! Current processed entry in the tree
+   EAliAnalysisExecMode    fMode;         // Execution mode
+   Bool_t                  fInitOK;       // Initialisation done
+   UInt_t                  fDebug;        // Debug level
+   TObjArray              *fTasks;        // List of analysis tasks
+   TObjArray              *fTopTasks;     // List of top tasks
+   TObjArray              *fZombies;      // List of zombie tasks
+   TObjArray              *fContainers;   // List of all containers
+   TObjArray              *fInputs;       // List of containers with input data
+   TObjArray              *fOutputs;      // List of containers with results
 
    static AliAnalysisManager *fgAnalysisManager; //! static pointer to object instance
    ClassDef(AliAnalysisManager,1)  // Analysis manager class