updated ChangeLog, incremented version id after tagging v0-6
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisManager.h
CommitLineData
d3106602 1#ifndef ALIANALYSISMANAGER_H
2#define ALIANALYSISMANAGER_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7// Author: Andrei Gheata, 31/05/2006
8
9//==============================================================================
10// AliAnalysysManager - Manager analysis class. Allows creation of several
11// analysis tasks and data containers storing their input/output. Allows
12// connecting/chaining tasks via shared data containers. Serializes the current
13// event for all tasks depending only on initial input data.
14//==============================================================================
15
c52c2132 16#ifndef ROOT_TNamed
17#include <TNamed.h>
d3106602 18#endif
19
20class TClass;
c52c2132 21class TTree;
d3106602 22class AliAnalysisDataContainer;
23class AliAnalysisTask;
24
c52c2132 25class AliAnalysisManager : public TNamed {
d3106602 26
27public:
28
29enum EAliAnalysisContType {
c52c2132 30 kExchangeContainer = 0,
d3106602 31 kInputContainer = 1,
32 kOutputContainer = 2
33};
c52c2132 34
35enum EAliAnalysisExecMode {
36 kLocalAnalysis = 0,
37 kProofAnalysis = 1,
38 kGridAnalysis = 2
39};
40
efd53803 41enum EAliAnalysisFlags {
42 kEventLoop = BIT(14)
43};
44
d3106602 45 AliAnalysisManager();
c52c2132 46 AliAnalysisManager(const char *name, const char *title="");
d3106602 47 virtual ~AliAnalysisManager();
c52c2132 48
49 AliAnalysisManager(const AliAnalysisManager& other);
50 AliAnalysisManager& operator=(const AliAnalysisManager& other);
d3106602 51
c52c2132 52 void StartAnalysis(const char *type="local", TTree *tree=0);
53
d3106602 54 virtual void Init(TTree *tree);
55 virtual void Begin(TTree *tree);
327eaf46 56 virtual Bool_t Notify();
d3106602 57 virtual void SlaveBegin(TTree *tree);
327eaf46 58 virtual Bool_t ProcessCut(Long64_t entry) {return Process(entry);}
d3106602 59 virtual Bool_t Process(Long64_t entry);
327eaf46 60 virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0);
c52c2132 61 void PackOutput(TList *target);
62 void UnpackOutput(TList *source);
d3106602 63 virtual void Terminate();
64
c52c2132 65 // Getters/Setters
66 static AliAnalysisManager *GetAnalysisManager() {return fgAnalysisManager;}
d3106602 67 TObjArray *GetContainers() const {return fContainers;}
c52c2132 68 UInt_t GetDebugLevel() const {return fDebug;}
d3106602 69 TObjArray *GetInputs() const {return fInputs;}
70 TObjArray *GetOutputs() const {return fOutputs;}
71 TObjArray *GetTasks() const {return fTasks;}
72 TObjArray *GetTopTasks() const {return fTopTasks;}
c52c2132 73 TTree *GetTree() const {return fTree;}
d3106602 74 TObjArray *GetZombieTasks() const {return fZombies;}
c52c2132 75 Long64_t GetCurrentEntry() const {return fCurrentEntry;}
76 EAliAnalysisExecMode
77 GetAnalysisType() const {return fMode;}
78
79 void SetAnalysisType(EAliAnalysisExecMode mode) {fMode = mode;}
80 void SetCurrentEntry(Long64_t entry) {fCurrentEntry = entry;}
81 void SetDebugLevel(UInt_t level) {fDebug = level;}
d3106602 82
83 // Container handling
84 AliAnalysisDataContainer *CreateContainer(const char *name, TClass *datatype,
c52c2132 85 EAliAnalysisContType type = kExchangeContainer,
86 const char *filename = NULL);
d3106602 87
88 // Including tasks and getting them
89 void AddTask(AliAnalysisTask *task);
90 AliAnalysisTask *GetTask(const char *name) const;
91
92 // Connecting data containers to task inputs/outputs
93 Bool_t ConnectInput(AliAnalysisTask *task, Int_t islot,
94 AliAnalysisDataContainer *cont);
95 Bool_t ConnectOutput(AliAnalysisTask *task, Int_t islot,
96 AliAnalysisDataContainer *cont);
97 // Garbage collection
98 void CleanContainers();
99
100 // Analysis initialization and execution, status
101 Bool_t InitAnalysis();
102 Bool_t IsInitialized() const {return fInitOK;}
efd53803 103 Bool_t IsEventLoop() const {return TObject::TestBit(kEventLoop);}
d3106602 104 void ResetAnalysis();
105 void ExecAnalysis(Option_t *option="");
106 void FinishAnalysis();
107 void PrintStatus(Option_t *option="all") const;
108
109protected:
981f2614 110 void ImportWrappers(TList *source);
efd53803 111 void SetEventLoop(Bool_t flag=kTRUE) {TObject::SetBit(kEventLoop,flag);}
d3106602 112
5daf9fd2 113private:
c52c2132 114 TTree *fTree; //! Input tree in case of TSelector model
115 Long64_t fCurrentEntry; //! Current processed entry in the tree
116 EAliAnalysisExecMode fMode; // Execution mode
117 Bool_t fInitOK; // Initialisation done
118 UInt_t fDebug; // Debug level
119 TObjArray *fTasks; // List of analysis tasks
120 TObjArray *fTopTasks; // List of top tasks
121 TObjArray *fZombies; // List of zombie tasks
122 TObjArray *fContainers; // List of all containers
123 TObjArray *fInputs; // List of containers with input data
124 TObjArray *fOutputs; // List of containers with results
5daf9fd2 125
c52c2132 126 static AliAnalysisManager *fgAnalysisManager; //! static pointer to object instance
d3106602 127 ClassDef(AliAnalysisManager,1) // Analysis manager class
128};
129#endif