Corrected sintax of the commands in ProcessLine (Yves)
[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 {
b1310ef5 42 kEventLoop = BIT(14),
43 kDisableBranches = BIT(15)
efd53803 44};
45
d3106602 46 AliAnalysisManager();
c52c2132 47 AliAnalysisManager(const char *name, const char *title="");
d3106602 48 virtual ~AliAnalysisManager();
c52c2132 49
50 AliAnalysisManager(const AliAnalysisManager& other);
51 AliAnalysisManager& operator=(const AliAnalysisManager& other);
d3106602 52
c52c2132 53 void StartAnalysis(const char *type="local", TTree *tree=0);
54
d3106602 55 virtual void Init(TTree *tree);
56 virtual void Begin(TTree *tree);
327eaf46 57 virtual Bool_t Notify();
d3106602 58 virtual void SlaveBegin(TTree *tree);
327eaf46 59 virtual Bool_t ProcessCut(Long64_t entry) {return Process(entry);}
d3106602 60 virtual Bool_t Process(Long64_t entry);
327eaf46 61 virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0);
c52c2132 62 void PackOutput(TList *target);
63 void UnpackOutput(TList *source);
d3106602 64 virtual void Terminate();
65
c52c2132 66 // Getters/Setters
67 static AliAnalysisManager *GetAnalysisManager() {return fgAnalysisManager;}
d3106602 68 TObjArray *GetContainers() const {return fContainers;}
c52c2132 69 UInt_t GetDebugLevel() const {return fDebug;}
d3106602 70 TObjArray *GetInputs() const {return fInputs;}
71 TObjArray *GetOutputs() const {return fOutputs;}
72 TObjArray *GetTasks() const {return fTasks;}
73 TObjArray *GetTopTasks() const {return fTopTasks;}
c52c2132 74 TTree *GetTree() const {return fTree;}
d3106602 75 TObjArray *GetZombieTasks() const {return fZombies;}
c52c2132 76 Long64_t GetCurrentEntry() const {return fCurrentEntry;}
77 EAliAnalysisExecMode
78 GetAnalysisType() const {return fMode;}
79
80 void SetAnalysisType(EAliAnalysisExecMode mode) {fMode = mode;}
81 void SetCurrentEntry(Long64_t entry) {fCurrentEntry = entry;}
82 void SetDebugLevel(UInt_t level) {fDebug = level;}
b1310ef5 83 void SetDisableBranches(Bool_t disable=kTRUE) {TObject::SetBit(kDisableBranches,disable);}
d3106602 84
85 // Container handling
86 AliAnalysisDataContainer *CreateContainer(const char *name, TClass *datatype,
c52c2132 87 EAliAnalysisContType type = kExchangeContainer,
88 const char *filename = NULL);
d3106602 89
90 // Including tasks and getting them
91 void AddTask(AliAnalysisTask *task);
92 AliAnalysisTask *GetTask(const char *name) const;
93
94 // Connecting data containers to task inputs/outputs
95 Bool_t ConnectInput(AliAnalysisTask *task, Int_t islot,
96 AliAnalysisDataContainer *cont);
97 Bool_t ConnectOutput(AliAnalysisTask *task, Int_t islot,
98 AliAnalysisDataContainer *cont);
99 // Garbage collection
100 void CleanContainers();
101
102 // Analysis initialization and execution, status
103 Bool_t InitAnalysis();
104 Bool_t IsInitialized() const {return fInitOK;}
efd53803 105 Bool_t IsEventLoop() const {return TObject::TestBit(kEventLoop);}
d3106602 106 void ResetAnalysis();
107 void ExecAnalysis(Option_t *option="");
108 void FinishAnalysis();
109 void PrintStatus(Option_t *option="all") const;
110
111protected:
981f2614 112 void ImportWrappers(TList *source);
efd53803 113 void SetEventLoop(Bool_t flag=kTRUE) {TObject::SetBit(kEventLoop,flag);}
d3106602 114
5daf9fd2 115private:
c52c2132 116 TTree *fTree; //! Input tree in case of TSelector model
117 Long64_t fCurrentEntry; //! Current processed entry in the tree
118 EAliAnalysisExecMode fMode; // Execution mode
119 Bool_t fInitOK; // Initialisation done
120 UInt_t fDebug; // Debug level
121 TObjArray *fTasks; // List of analysis tasks
122 TObjArray *fTopTasks; // List of top tasks
123 TObjArray *fZombies; // List of zombie tasks
124 TObjArray *fContainers; // List of all containers
125 TObjArray *fInputs; // List of containers with input data
126 TObjArray *fOutputs; // List of containers with results
5daf9fd2 127
c52c2132 128 static AliAnalysisManager *fgAnalysisManager; //! static pointer to object instance
d3106602 129 ClassDef(AliAnalysisManager,1) // Analysis manager class
130};
131#endif